package top.wilbert.collegelink.message.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.wilbert.collegelink.message.dao.ChatListDao;
import top.wilbert.collegelink.message.dao.ChatUserLinkDao;
import top.wilbert.collegelink.message.entity.ChatListEntity;
import top.wilbert.collegelink.message.entity.ChatUserLinkEntity;
import top.wilbert.collegelink.message.service.ChatListService;
import top.wilbert.collegelink.message.service.ChatUserLinkService;

/**
 * @Description:
 * @Author:Jiiangyu
 * @CreatTime:2023-02-27-19:49
 */
@Service("ChatUserLinkService")
public class ChatUserLinkServiceImpl extends ServiceImpl<ChatUserLinkDao, ChatUserLinkEntity> implements ChatUserLinkService {
    @Override
    public ChatUserLinkEntity getLinkByNames(String fromName, String toName) {

        QueryWrapper<ChatUserLinkEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("from_user", fromName).eq("to_user", toName);

        return this.baseMapper.selectOne(queryWrapper);
    }
}
